import Vue from 'vue'
import VueRouter from 'vue-router'
import AdminManage from '../components/AdminManage.vue'
import StudentList from '../components/StudentList.vue'
import TeacherList from '../components/Teacher.vue'
import TableSelector from '../components/TableSelector.vue'
import AdminDashboard from '../components/AdminDashboard.vue'
import ProductManagement from '../components/ProductManagement.vue'
import ProductList from '../components/admin/ProductList.vue'
import AddProduct from '../components/admin/AddProduct.vue'
import BrandList from '../components/admin/BrandList.vue'
import TypeList from '../components/admin/TypeList.vue'
import ColorList from '../components/admin/ColorList.vue'
import SizeList from '../components/admin/SizeList.vue'
import StockManagement from '../components/admin/StockManagement.vue'
import OrderManagement from '../components/admin/OrderManagement.vue'
import PendingOrders from '../components/admin/PendingOrders.vue'
import ApiTest from '../components/ApiTest.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Admin',
    component: AdminManage
  },
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: AdminDashboard
  },
  {
    path: '/tables',
    name: 'Tables',
    component: TableSelector
  },
  {
    path: '/student',
    name: 'Student',
    component: StudentList
  },
  {
    path: '/teacher',
    name: 'Teacher',
    component: TeacherList
  },
  {
    path: '/api-test',
    name: 'ApiTest',
    component: ApiTest
  },
  {
    path: '/product-management',
    name: 'ProductManagement',
    component: ProductManagement,
    children: [
      {
        path: 'products',
        name: 'ProductList',
        component: ProductList
      },
      {
        path: 'add-product',
        name: 'AddProduct',
        component: AddProduct
      },
      {
        path: 'brands',
        name: 'BrandList',
        component: BrandList
      },
      {
        path: 'types',
        name: 'TypeList',
        component: TypeList
      },
      {
        path: 'colors',
        name: 'ColorList',
        component: ColorList
      },
      {
        path: 'sizes',
        name: 'SizeList',
        component: SizeList
      },
      {
        path: 'stock',
        name: 'StockManagement',
        component: StockManagement
      }
    ]
  },
  {
    path: '/order-management',
    name: 'OrderManagement',
    component: OrderManagement
  },
  {
    path: '/pending-orders',
    name: 'PendingOrders',
    component: PendingOrders
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router